package com.j180.controller;

import com.j180.bean.ResultBean;
import com.j180.bean.UserBean;
import com.j180.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService iUserService;

    @GetMapping("/showAll")
    public ResultBean showAll(@RequestParam("curPage") int curPage,@RequestParam("pagesize") int pageSize){

       return  iUserService.showAll(curPage,pageSize);
    }

    @PostMapping("/add")
    public String addUser(UserBean userBean){

       int num= iUserService.addUser(userBean);
       if(num>0){

           return "ok";
       }
        return "no";
    }

}
